package com.pitaya.winwine.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.pitaya.framework.common.ErrorInfo;

@Entity
@Table(name = "tb_wine")
public class Wine implements Serializable {

	private static final long serialVersionUID = -8680861019826750268L;
	
	public static final int DEFAULT_CAPACITY = 750;

	@Id @GeneratedValue
	private Integer id;
	private String barcode;
	
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	@JoinColumn(name = "typeId")
	private Dict type;
	@Column(insertable = false, updatable = false)
	private Integer typeId;
	
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
	@JoinColumn(name = "countryId")
	private Dict country;
	@Column(insertable = false, updatable = false)
	private Integer countryId;
	
	private String region;
	private Integer vintage;
	private String chName;
	private String enName;
  	private String variety;
  	private Integer capacity;
  	private String grade;
  	private Integer alcoho;
  	private String picUrl;

  	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
  	@JoinColumn(name = "creatorId")
  	private User creator;
  	private Date createTime;
  	
  	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
  	@JoinColumn(name = "editorId")
  	private User editor;
  	private Date editTime;
  	
  	@Transient
  	private ErrorInfo errorInfo;
  	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getBarcode() {
		return barcode;
	}
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}
	public Dict getType() {
		return type;
	}
	public void setType(Dict type) {
		this.type = type;
	}
	public Integer getTypeId() {
		return typeId;
	}
	public void setTypeId(Integer typeId) {
		this.typeId = typeId;
	}
	public Dict getCountry() {
		return country;
	}
	public void setCountry(Dict country) {
		this.country = country;
	}
	public Integer getCountryId() {
		return countryId;
	}
	public void setCountryId(Integer countryId) {
		this.countryId = countryId;
	}
	public String getRegion() {
		return region;
	}
	public void setRegion(String region) {
		this.region = region;
	}
	public Integer getVintage() {
		return vintage;
	}
	public void setVintage(Integer vintage) {
		this.vintage = vintage;
	}
	public String getChName() {
		return chName;
	}
	public void setChName(String chName) {
		this.chName = chName;
	}
	public String getEnName() {
		return enName;
	}
	public void setEnName(String enName) {
		this.enName = enName;
	}
	public String getVariety() {
		return variety;
	}
	public void setVariety(String variety) {
		this.variety = variety;
	}
	public Integer getCapacity() {
		return capacity;
	}
	public void setCapacity(Integer capacity) {
		this.capacity = capacity;
	}
	public String getGrade() {
		return grade;
	}
	public void setGrade(String grade) {
		this.grade = grade;
	}
	public Integer getAlcoho() {
		return alcoho;
	}
	public void setAlcoho(Integer alcoho) {
		this.alcoho = alcoho;
	}
	public String getPicUrl() {
		return picUrl;
	}
	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}
	public User getCreator() {
		return creator;
	}
	public void setCreator(User creator) {
		this.creator = creator;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public User getEditor() {
		return editor;
	}
	public void setEditor(User editor) {
		this.editor = editor;
	}
	public Date getEditTime() {
		return editTime;
	}
	public void setEditTime(Date editTime) {
		this.editTime = editTime;
	}
	
	public ErrorInfo getErrorInfo() {
		return errorInfo;
	}
	public void setErrorInfo(ErrorInfo errorInfo) {
		this.errorInfo = errorInfo;
	}
}
